Requirements Documentation

Table of Contents


System Overview

The Elevator Simulation System is a comprehensive multi-elevator management system that simulates real-world elevator operations. The system manages two elevators operating across four floors (-1, 1, 2, 3) and handles various user interactions including floor calls, destination selections, and manual door operations.

Key System Components:


Use Case Diagram

graph LR subgraph "Elevator System" subgraph "User Interactions" UC1[Call Elevator from Floor] UC2[Select Destination Floor] UC3[Open Door Manually] UC4[Close Door Manually] UC5[Reset System] end subgraph "System Operations" UC6[Dispatch Elevator] UC7[Move Elevator] UC8[Auto Door Operations] UC9[State Synchronization] end end subgraph "Actors" USER[Building User] ADMIN[System Administrator] WEB_UI[Web Frontend] end USER --> UC1 USER --> UC2 USER --> UC3 USER --> UC4 ADMIN --> UC5 WEB_UI --> UC9 UC1 --> UC6 UC2 --> UC6 UC6 --> UC7 UC7 --> UC8 UC6 --> UC9 UC7 --> UC9 UC8 --> UC9

Use Case Descriptions:

Primary Use Cases:

System Operation Use Cases:


Class Diagram

classDiagram class ElevatorSystem { -List~Elevator~ elevators -Dispatcher dispatcher +requestElevator(floor: int, direction: string) +selectDestination(elevatorId: int, floor: int) +updateState() } class Dispatcher { -List~Elevator~ elevators +addCall(floor: int, direction: string) +assignCallToElevator(floor: int, direction: string) Elevator +findBestElevator(floor: int, direction: string) Elevator } class Elevator { -int id -int currentFloor -string state // Replaced ElevatorState enum -string doorState // Replaced DoorState enum -string currentMoveDirection // Replaced MoveDirection enum -List~object~ assignedCalls // Replaced List~Call~ +moveTo(floor: int) +openDoor() +closeDoor() +addCall(floor: int, direction: string) // Modified to reflect no Call class +update() } ElevatorSystem "1" *-- "1" Dispatcher : uses ElevatorSystem "1" o-- "*" Elevator : manages Dispatcher ..> Elevator : evaluates

Class Descriptions:

Core System Classes:

Data Model Classes:

Communication Classes:


Sequence Diagrams

1. External System Elevator Call Sequence

When an external system requests an elevator to floor A, the system first receives and parses the call command. The dispatcher evaluates all available elevators to calculate their estimated service times, then assigns the task to the elevator with the shortest wait time. Once assigned, the selected elevator begins moving upward, continuously updating its position until it reaches floor A. Upon arrival, the elevator automatically opens its doors and sends confirmation messages back to the external system. Throughout this process, the system maintains real-time synchronization with the web frontend to display current elevator status.

sequenceDiagram participant EXT as External System participant API as ElevatorAPI participant DISP as Dispatcher participant ELV as Elevator participant WS as WebSocketBridge participant UI as Web Frontend EXT->>+API: call_up@2 API->>API: _parse_and_execute() API->>+DISP: add_call(2, "up") DISP->>DISP: create Call object DISP->>DISP: _process_pending_calls() loop For each elevator DISP->>+ELV: calculate_estimated_time(2, "up") ELV-->>-DISP: estimated_time end DISP->>DISP: select best elevator DISP->>+ELV: assign_task(2, call_id) ELV->>ELV: add Task to queue ELV-->>-DISP: task assigned DISP-->>-API: call processed API-->>-EXT: success/failure response ELV->>ELV: request_movement_if_needed() ELV->>ELV: state = MOVING_UP loop Until arrival ELV->>ELV: update() - movement logic end ELV->>ELV: arrive at floor 2 ELV->>+API: send_floor_arrived_message() API-->>EXT: up_floor_2_arrived#1 API-->>-ELV: message sent ELV->>ELV: open_door() ELV->>ELV: door_state = OPENING ELV->>+API: send_door_opened_message() API-->>EXT: door_opened#1 API-->>-ELV: message sent ELV->>+WS: state update WS->>+UI: elevator state update UI->>UI: updateElevatorUI() UI-->>-WS: UI updated WS-->>-ELV: sync complete

Functional Requirements

FR1: Elevator Movement Management

FR2: Door Operation Management

FR3: Call Dispatching System

FR4: User Interface Requirements